﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NeuralNetworkPro.Activation_Functions
{
    [Serializable]
    public class HyperTangentFunction : IActivationFunction
    {
        public double Function(double x)
        {
            return Math.Tanh(x);
        }

        public double Derivative(double x)
        {  //4·e^(2·x)/(e^(2·x) + 1)^2
            return 4 * Math.Exp(2 * x) / Math.Pow(Math.Exp(2 * x) + 1, 2);
        }

        public override string ToString()
        {
            return Name;
        }

        public string Name
        {
            get { return "HyperTangentFunction"; }
        }

        public static readonly string FunctionName = "HyperTangentFunction";
    }
}
